import org.apache.commons.pool.BasePoolableObjectFactory
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.HttpWebConnection
import com.gargoylesoftware.htmlunit.WebRequestSettings
import com.gargoylesoftware.htmlunit.WebResponse
/**
 * Created by IntelliJ IDEA.
 * User: AlexandruA
 * Date: 7/15/11
 * Time: 11:28 AM
 * To change this template use File | Settings | File Templates.
 */
class BugzillaConnectionPoolFactory extends BasePoolableObjectFactory {
    @Override
    Object makeObject() {
        def webClient = new WebClient();
        webClient.setCssEnabled(false);
        webClient.setJavaScriptEnabled(false);
        webClient.setWebConnection(new HttpWebConnection(webClient) {
            WebResponse getResponse(WebRequestSettings webRequest) {
                System.out.println(" url = " + webRequest.url + webRequest.requestParameters);
                return super.getResponse(webRequest);
            }
        });
        return webClient;
    }

}
